package com.qs.eggs.integral.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.qs.eggs.Constants;
import com.qs.eggs.R;
import com.qs.eggs.adapter.CollectAdapter;
import com.qs.eggs.base.activity.BaseActivity;
import com.qs.eggs.bean.CollectBean;
import com.qs.eggs.refresh.widget.RecyclerRefreshLayout;
import com.qs.eggs.utils.CookiesUtil;

import org.apache.http.cookie.Cookie;

import java.lang.reflect.Type;
import java.util.ArrayList;

import okhttp3.Call;
import okhttp3.Response;

public class LuckyActivity extends BaseActivity{
    public static Activity instance;
    private WebView webView;
    @Override
    protected int getContentView() {
        return R.layout.activity_lucky;
    }

    @Override
    protected void initWidget() {
        super.initWidget();
        instance=this;
        webView=(WebView)findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);

    }

    @Override
    protected void initData() {
        super.initData();

        webView.setWebViewClient(new MyWebViewClient());
        webView.setWebChromeClient(new WebChromeClient());
        //一定要把cookie设置放在上面两个属性设置之后
        CookiesUtil.syncCookie(this,Constants.URL_BASE+"eggMatter/weixinpage/choujiang/choujiang/index1.html");
        webView.loadUrl(Constants.URL_BASE+"eggMatter/weixinpage/choujiang/choujiang/index1.html");
        }

    private class MyWebViewClient extends WebViewClient {

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }


}
